package com.lei.service.impl;

import com.lei.dao.DeptDao;
import com.lei.dao.impl.DeptDaoImpl;
import com.lei.entity.Dept;
import com.lei.service.DeptService;
import com.lei.util.PageBean;

import java.util.List;

/**
 * @author Lei Chu
 * @Date 2020/10/16 21:34
 */
public class DeptServiceImpl implements DeptService {

    private DeptDao deptDao = new DeptDaoImpl();

    @Override
    public void selectAllDept(PageBean<Dept> pageBean) {
        deptDao.selectAllDept(pageBean);
    }

    @Override
    public int findIDDeptByName(String dname) {
        return deptDao.findIDDeptByName(dname);
    }

    @Override
    public int addDept(Dept dept) {
        return deptDao.addDept(dept);
    }

    @Override
    public void selectAllDeptById(PageBean page) {
        deptDao.selectAllDeptById(page);
    }

    @Override
    public void selectAllDeptByName(PageBean page) {
        deptDao.selectAllDeptByName(page);
    }

    @Override
    public int selectLastDeptNo() {
        return deptDao.selectLastDeptNo();
    }

    @Override
    public int updateDept(Dept dept) {
        return deptDao.updateDept(dept);
    }

    @Override
    public List<Dept> getAllDept() {
        return deptDao.getAllDept();
    }

    @Override
    public String deleteDept(int deptid) {
        int result = deptDao.deleteDept(deptid);
        return result+"";
    }

    @Override
    public int updateDeptStatus(int deptid, int status) {
        return deptDao.updateDeptStatus(deptid,status);
    }
}
